﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Mondol.DapperPoco;
using Mondol.DapperPoco.Adapters;
using System.Data.SqlClient;
using System.Data.Entity.Core;
using System.Data.Entity.Core.Metadata.Edm;

namespace ConsoleTest
{
    public class MasterDbContext : DbContext
    {
        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            optionsBuilder.UseConnectionString(System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ToString());
            //使用SQL Server数据库
            optionsBuilder.UseSqlAdapter(new SqlServerAdapter(SqlClientFactory.Instance));
        }

        //如果不使用Poco可以不重写此方法
        protected override void OnEntitiesBuilding(EntitiesBuilder entityBuilder)
        {
         
            //entityBuilder.Entity<KS_SMHS_DETAIL_TBL>()
            //    .TableName("KS_SMHS_DETAIL_TBL")
            //    .PrimaryKey(p => p.KSX_ID, true);
        }
    }
}
